peanut.ReportQuery = Ext.extend(peanut.QueryPanel, {
    id: "QueryInfoPanelId",
    title: "报表管理",
    //width: 400,
	//height: 300,
    //这个是数据源url
    baseUrl: __base+"/admin/user/all",
    ID: "userCode",
    storeMapping: ["userCode","userName","enabled"],

    //表单元素
    row1: {
		layout:'column',
		bodyStyle:'border-width:0;',
		items:[{
			columnWidth:.5,  
            layout:'form',
            bodyStyle:'border-width:0;',
            //baseCls:'x-plain',
            items:[{
            	id:'name1',
            	xtype:'textfield',  
            	labelStyle:'text-align:right;',
                fieldLabel:'名称'
            }]
		},{
			columnWidth:.5,  
            layout:'form',
            bodyStyle:'border-width:0;',
            //baseCls:'x-plain',
            items:[{
            	xtype:'textfield',  
            	labelStyle:'text-align:right;',
                fieldLabel:'名称2' 
            }]
		}]
    },
    
    constructor: function(config){
        //this.sm = new Ext.grid.CellSelectionModel();
        
        this.cm = new Ext.grid.ColumnModel([
            new Ext.grid.RowNumberer(),//获得行号
		    //this.sm,
		    {
		        header:"编号",
		        dataIndex:"userCode",
		        align:'center',
		        style:'font-weight:bold;',
		        //可以进行排序
                sortable:true
	        },{
		        header:"姓名",
		        dataIndex:"userName",
		        align:'center',
                sortable:true,
                style:'font-weight:bold;',
                renderer:function(value)
                {
                    return "<font color=#EE9572>"+value+"</font>";
                }
	        },{
		        header:"是否可用",
		        width:80,
		        style:'font-weight:bold;',
		        align:'center',
		        dataIndex:"enabled",
                sortable:true,
                renderer:function(value) {
                    return value == '1' ? '启用' : '禁用';
                }
	        }
	    ]);
        
        /**
	     * 表单定义开始
	    **/
	    var fp = new Ext.form.FormPanel({
	    	plain:true,
	    	frame:true,
	    	bodyStyle:'border-width:0;height:95.5%;width:100%',
			layout:"form",
			//defaultType:"textfield",
			labelWidth:75,
	        //baseCls:"x-plain",
			//defaults:{anchor:"30%",msgTarget:"side"},
			anchor:'100%',
			autoHeight:true,
			buttonAlign:"right",
			labelAlign:"center",
			//bodyStyle:"padding:10 10 10 10",
	    	items:[this.row1],
	    	buttons:[{
	    		text:'查询',
	    		handler: this.onSearch,
	    		scope:this
	    	}]
	    });
	    /**
	     * 表单定义结束
	    **/
        
	    //额外属性
        config.fp = fp,
        
        peanut.ReportQuery.superclass.constructor.call(this,config);
    },
    onSearch:function() {
    	//var keyword = this.fp.items[2].getValue();//得到输入框的值
    	var p1 = Ext.getCmp('name1').getValue();
    	alert(p1);
        this.store.load({
            params: {
                start: 0,
                limit: 10,
                p1: p1
            }
        });
    }
});
